
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 11/24/2012 00:45:44
-- Generated from EDMX file: C:\Users\firegun\Desktop\TCC\Programa\SlotDuino\SlotDuino.DAL\SlotDuinoModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [slotduino];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_TrackSlot]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Slots] DROP CONSTRAINT [FK_TrackSlot];
GO
IF OBJECT_ID(N'[dbo].[FK_OperatorRace]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Races] DROP CONSTRAINT [FK_OperatorRace];
GO
IF OBJECT_ID(N'[dbo].[FK_PilotRaceSlot]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[RacesSlots] DROP CONSTRAINT [FK_PilotRaceSlot];
GO
IF OBJECT_ID(N'[dbo].[FK_RaceRaceSlot]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[RacesSlots] DROP CONSTRAINT [FK_RaceRaceSlot];
GO
IF OBJECT_ID(N'[dbo].[FK_RaceSlotLap]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Laps] DROP CONSTRAINT [FK_RaceSlotLap];
GO
IF OBJECT_ID(N'[dbo].[FK_PilotChampionshipEnrollment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ChampionshipEnrollments] DROP CONSTRAINT [FK_PilotChampionshipEnrollment];
GO
IF OBJECT_ID(N'[dbo].[FK_ChampionshipChampionshipEnrollment]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ChampionshipEnrollments] DROP CONSTRAINT [FK_ChampionshipChampionshipEnrollment];
GO
IF OBJECT_ID(N'[dbo].[FK_RaceSlotSlot]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[RacesSlots] DROP CONSTRAINT [FK_RaceSlotSlot];
GO
IF OBJECT_ID(N'[dbo].[FK_TrackVoltage]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Voltages] DROP CONSTRAINT [FK_TrackVoltage];
GO
IF OBJECT_ID(N'[dbo].[FK_ChampionshipChampionshipHeat]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ChampionshipHeats] DROP CONSTRAINT [FK_ChampionshipChampionshipHeat];
GO
IF OBJECT_ID(N'[dbo].[FK_ChampionshipHeatChampionshipRace]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Races_ChampionshipRace] DROP CONSTRAINT [FK_ChampionshipHeatChampionshipRace];
GO
IF OBJECT_ID(N'[dbo].[FK_TrackRace]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Races] DROP CONSTRAINT [FK_TrackRace];
GO
IF OBJECT_ID(N'[dbo].[FK_Operator_inherits_Person]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[People_Operator] DROP CONSTRAINT [FK_Operator_inherits_Person];
GO
IF OBJECT_ID(N'[dbo].[FK_Pilot_inherits_Person]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[People_Pilot] DROP CONSTRAINT [FK_Pilot_inherits_Person];
GO
IF OBJECT_ID(N'[dbo].[FK_ChampionshipRace_inherits_Race]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Races_ChampionshipRace] DROP CONSTRAINT [FK_ChampionshipRace_inherits_Race];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[People]', 'U') IS NOT NULL
    DROP TABLE [dbo].[People];
GO
IF OBJECT_ID(N'[dbo].[Races]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Races];
GO
IF OBJECT_ID(N'[dbo].[RacesSlots]', 'U') IS NOT NULL
    DROP TABLE [dbo].[RacesSlots];
GO
IF OBJECT_ID(N'[dbo].[Tracks]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Tracks];
GO
IF OBJECT_ID(N'[dbo].[Slots]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Slots];
GO
IF OBJECT_ID(N'[dbo].[Laps]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Laps];
GO
IF OBJECT_ID(N'[dbo].[Championships]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Championships];
GO
IF OBJECT_ID(N'[dbo].[ChampionshipEnrollments]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ChampionshipEnrollments];
GO
IF OBJECT_ID(N'[dbo].[Voltages]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Voltages];
GO
IF OBJECT_ID(N'[dbo].[ChampionshipTemplates]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ChampionshipTemplates];
GO
IF OBJECT_ID(N'[dbo].[ChampionshipHeats]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ChampionshipHeats];
GO
IF OBJECT_ID(N'[dbo].[Companies]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Companies];
GO
IF OBJECT_ID(N'[dbo].[People_Operator]', 'U') IS NOT NULL
    DROP TABLE [dbo].[People_Operator];
GO
IF OBJECT_ID(N'[dbo].[People_Pilot]', 'U') IS NOT NULL
    DROP TABLE [dbo].[People_Pilot];
GO
IF OBJECT_ID(N'[dbo].[Races_ChampionshipRace]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Races_ChampionshipRace];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'People'
CREATE TABLE [dbo].[People] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(250)  NOT NULL,
    [Email] nvarchar(250)  NULL,
    [Birthday] datetime  NULL,
    [Phone] nvarchar(50)  NULL
);
GO

-- Creating table 'Races'
CREATE TABLE [dbo].[Races] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [OperatorId] int  NOT NULL,
    [Start] datetime  NULL,
    [Finish] datetime  NULL,
    [State] tinyint  NOT NULL,
    [Duration] time  NOT NULL,
    [TrackId] int  NOT NULL
);
GO

-- Creating table 'RacesSlots'
CREATE TABLE [dbo].[RacesSlots] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [PilotId] int  NOT NULL,
    [RaceId] int  NOT NULL,
    [SlotId] tinyint  NOT NULL,
    [SlotTrackId] int  NOT NULL,
    [Voltage] tinyint  NOT NULL
);
GO

-- Creating table 'Tracks'
CREATE TABLE [dbo].[Tracks] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(150)  NOT NULL,
    [Length] float  NOT NULL,
    [MAC] nchar(17)  NOT NULL,
    [MinLapTime] time  NOT NULL,
    [MaxLapTime] time  NOT NULL,
    [HasVoltageControl] bit  NOT NULL
);
GO

-- Creating table 'Slots'
CREATE TABLE [dbo].[Slots] (
    [Id] tinyint IDENTITY(1,1) NOT NULL,
    [TrackId] int  NOT NULL,
    [Color] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'Laps'
CREATE TABLE [dbo].[Laps] (
    [Number] int  NOT NULL,
    [RaceSlotId] int  NOT NULL,
    [Time] datetimeoffset  NOT NULL
);
GO

-- Creating table 'Championships'
CREATE TABLE [dbo].[Championships] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [StartDate] datetime  NOT NULL,
    [EndDate] datetime  NOT NULL,
    [QualifyingTime] time  NOT NULL,
    [RaceTime] time  NOT NULL,
    [IntervalTime] time  NOT NULL,
    [State] tinyint  NOT NULL
);
GO

-- Creating table 'ChampionshipEnrollments'
CREATE TABLE [dbo].[ChampionshipEnrollments] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [PilotId] int  NOT NULL,
    [ChampionshipId] int  NOT NULL,
    [QualifyTime] time  NOT NULL
);
GO

-- Creating table 'Voltages'
CREATE TABLE [dbo].[Voltages] (
    [Id] tinyint IDENTITY(1,1) NOT NULL,
    [TrackId] int  NOT NULL,
    [Label] nvarchar(max)  NOT NULL,
    [Default] bit  NOT NULL
);
GO

-- Creating table 'ChampionshipTemplates'
CREATE TABLE [dbo].[ChampionshipTemplates] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [QualifyingTime] time  NOT NULL,
    [RaceTime] time  NOT NULL,
    [IntervalTime] time  NOT NULL
);
GO

-- Creating table 'ChampionshipHeats'
CREATE TABLE [dbo].[ChampionshipHeats] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [ChampionshipId] int  NOT NULL,
    [Order] tinyint  NOT NULL,
    [Type] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'Companies'
CREATE TABLE [dbo].[Companies] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(250)  NOT NULL,
    [Address] nvarchar(max)  NULL,
    [City] nvarchar(50)  NULL,
    [State] nvarchar(50)  NULL,
    [Country] nvarchar(max)  NULL,
    [PostalCode] nvarchar(25)  NULL,
    [Phone] nvarchar(50)  NULL,
    [Email] nvarchar(250)  NULL,
    [HomePage] nvarchar(250)  NULL,
    [Logo] nvarchar(max)  NULL
);
GO

-- Creating table 'People_Operator'
CREATE TABLE [dbo].[People_Operator] (
    [Login] nvarchar(32)  NOT NULL,
    [Password] nchar(40)  NOT NULL,
    [IsAdministrator] bit  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- Creating table 'People_Pilot'
CREATE TABLE [dbo].[People_Pilot] (
    [Nickname] nvarchar(25)  NULL,
    [Id] int  NOT NULL
);
GO

-- Creating table 'Races_ChampionshipRace'
CREATE TABLE [dbo].[Races_ChampionshipRace] (
    [ChampionshipHeatId] int  NOT NULL,
    [Order] tinyint  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- Creating table 'Races_FreeRace'
CREATE TABLE [dbo].[Races_FreeRace] (
    [Id] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'People'
ALTER TABLE [dbo].[People]
ADD CONSTRAINT [PK_People]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Races'
ALTER TABLE [dbo].[Races]
ADD CONSTRAINT [PK_Races]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'RacesSlots'
ALTER TABLE [dbo].[RacesSlots]
ADD CONSTRAINT [PK_RacesSlots]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Tracks'
ALTER TABLE [dbo].[Tracks]
ADD CONSTRAINT [PK_Tracks]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id], [TrackId] in table 'Slots'
ALTER TABLE [dbo].[Slots]
ADD CONSTRAINT [PK_Slots]
    PRIMARY KEY CLUSTERED ([Id], [TrackId] ASC);
GO

-- Creating primary key on [Number], [RaceSlotId] in table 'Laps'
ALTER TABLE [dbo].[Laps]
ADD CONSTRAINT [PK_Laps]
    PRIMARY KEY CLUSTERED ([Number], [RaceSlotId] ASC);
GO

-- Creating primary key on [Id] in table 'Championships'
ALTER TABLE [dbo].[Championships]
ADD CONSTRAINT [PK_Championships]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'ChampionshipEnrollments'
ALTER TABLE [dbo].[ChampionshipEnrollments]
ADD CONSTRAINT [PK_ChampionshipEnrollments]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id], [TrackId] in table 'Voltages'
ALTER TABLE [dbo].[Voltages]
ADD CONSTRAINT [PK_Voltages]
    PRIMARY KEY CLUSTERED ([Id], [TrackId] ASC);
GO

-- Creating primary key on [Id] in table 'ChampionshipTemplates'
ALTER TABLE [dbo].[ChampionshipTemplates]
ADD CONSTRAINT [PK_ChampionshipTemplates]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'ChampionshipHeats'
ALTER TABLE [dbo].[ChampionshipHeats]
ADD CONSTRAINT [PK_ChampionshipHeats]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Companies'
ALTER TABLE [dbo].[Companies]
ADD CONSTRAINT [PK_Companies]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'People_Operator'
ALTER TABLE [dbo].[People_Operator]
ADD CONSTRAINT [PK_People_Operator]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'People_Pilot'
ALTER TABLE [dbo].[People_Pilot]
ADD CONSTRAINT [PK_People_Pilot]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Races_ChampionshipRace'
ALTER TABLE [dbo].[Races_ChampionshipRace]
ADD CONSTRAINT [PK_Races_ChampionshipRace]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Races_FreeRace'
ALTER TABLE [dbo].[Races_FreeRace]
ADD CONSTRAINT [PK_Races_FreeRace]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [TrackId] in table 'Slots'
ALTER TABLE [dbo].[Slots]
ADD CONSTRAINT [FK_TrackSlot]
    FOREIGN KEY ([TrackId])
    REFERENCES [dbo].[Tracks]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_TrackSlot'
CREATE INDEX [IX_FK_TrackSlot]
ON [dbo].[Slots]
    ([TrackId]);
GO

-- Creating foreign key on [OperatorId] in table 'Races'
ALTER TABLE [dbo].[Races]
ADD CONSTRAINT [FK_OperatorRace]
    FOREIGN KEY ([OperatorId])
    REFERENCES [dbo].[People_Operator]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_OperatorRace'
CREATE INDEX [IX_FK_OperatorRace]
ON [dbo].[Races]
    ([OperatorId]);
GO

-- Creating foreign key on [PilotId] in table 'RacesSlots'
ALTER TABLE [dbo].[RacesSlots]
ADD CONSTRAINT [FK_PilotRaceSlot]
    FOREIGN KEY ([PilotId])
    REFERENCES [dbo].[People_Pilot]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_PilotRaceSlot'
CREATE INDEX [IX_FK_PilotRaceSlot]
ON [dbo].[RacesSlots]
    ([PilotId]);
GO

-- Creating foreign key on [RaceId] in table 'RacesSlots'
ALTER TABLE [dbo].[RacesSlots]
ADD CONSTRAINT [FK_RaceRaceSlot]
    FOREIGN KEY ([RaceId])
    REFERENCES [dbo].[Races]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_RaceRaceSlot'
CREATE INDEX [IX_FK_RaceRaceSlot]
ON [dbo].[RacesSlots]
    ([RaceId]);
GO

-- Creating foreign key on [RaceSlotId] in table 'Laps'
ALTER TABLE [dbo].[Laps]
ADD CONSTRAINT [FK_RaceSlotLap]
    FOREIGN KEY ([RaceSlotId])
    REFERENCES [dbo].[RacesSlots]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_RaceSlotLap'
CREATE INDEX [IX_FK_RaceSlotLap]
ON [dbo].[Laps]
    ([RaceSlotId]);
GO

-- Creating foreign key on [PilotId] in table 'ChampionshipEnrollments'
ALTER TABLE [dbo].[ChampionshipEnrollments]
ADD CONSTRAINT [FK_PilotChampionshipEnrollment]
    FOREIGN KEY ([PilotId])
    REFERENCES [dbo].[People_Pilot]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_PilotChampionshipEnrollment'
CREATE INDEX [IX_FK_PilotChampionshipEnrollment]
ON [dbo].[ChampionshipEnrollments]
    ([PilotId]);
GO

-- Creating foreign key on [ChampionshipId] in table 'ChampionshipEnrollments'
ALTER TABLE [dbo].[ChampionshipEnrollments]
ADD CONSTRAINT [FK_ChampionshipChampionshipEnrollment]
    FOREIGN KEY ([ChampionshipId])
    REFERENCES [dbo].[Championships]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ChampionshipChampionshipEnrollment'
CREATE INDEX [IX_FK_ChampionshipChampionshipEnrollment]
ON [dbo].[ChampionshipEnrollments]
    ([ChampionshipId]);
GO

-- Creating foreign key on [SlotId], [SlotTrackId] in table 'RacesSlots'
ALTER TABLE [dbo].[RacesSlots]
ADD CONSTRAINT [FK_RaceSlotSlot]
    FOREIGN KEY ([SlotId], [SlotTrackId])
    REFERENCES [dbo].[Slots]
        ([Id], [TrackId])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_RaceSlotSlot'
CREATE INDEX [IX_FK_RaceSlotSlot]
ON [dbo].[RacesSlots]
    ([SlotId], [SlotTrackId]);
GO

-- Creating foreign key on [TrackId] in table 'Voltages'
ALTER TABLE [dbo].[Voltages]
ADD CONSTRAINT [FK_TrackVoltage]
    FOREIGN KEY ([TrackId])
    REFERENCES [dbo].[Tracks]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_TrackVoltage'
CREATE INDEX [IX_FK_TrackVoltage]
ON [dbo].[Voltages]
    ([TrackId]);
GO

-- Creating foreign key on [ChampionshipId] in table 'ChampionshipHeats'
ALTER TABLE [dbo].[ChampionshipHeats]
ADD CONSTRAINT [FK_ChampionshipChampionshipHeat]
    FOREIGN KEY ([ChampionshipId])
    REFERENCES [dbo].[Championships]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ChampionshipChampionshipHeat'
CREATE INDEX [IX_FK_ChampionshipChampionshipHeat]
ON [dbo].[ChampionshipHeats]
    ([ChampionshipId]);
GO

-- Creating foreign key on [ChampionshipHeatId] in table 'Races_ChampionshipRace'
ALTER TABLE [dbo].[Races_ChampionshipRace]
ADD CONSTRAINT [FK_ChampionshipHeatChampionshipRace]
    FOREIGN KEY ([ChampionshipHeatId])
    REFERENCES [dbo].[ChampionshipHeats]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ChampionshipHeatChampionshipRace'
CREATE INDEX [IX_FK_ChampionshipHeatChampionshipRace]
ON [dbo].[Races_ChampionshipRace]
    ([ChampionshipHeatId]);
GO

-- Creating foreign key on [TrackId] in table 'Races'
ALTER TABLE [dbo].[Races]
ADD CONSTRAINT [FK_TrackRace]
    FOREIGN KEY ([TrackId])
    REFERENCES [dbo].[Tracks]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_TrackRace'
CREATE INDEX [IX_FK_TrackRace]
ON [dbo].[Races]
    ([TrackId]);
GO

-- Creating foreign key on [Id] in table 'People_Operator'
ALTER TABLE [dbo].[People_Operator]
ADD CONSTRAINT [FK_Operator_inherits_Person]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[People]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Id] in table 'People_Pilot'
ALTER TABLE [dbo].[People_Pilot]
ADD CONSTRAINT [FK_Pilot_inherits_Person]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[People]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Id] in table 'Races_ChampionshipRace'
ALTER TABLE [dbo].[Races_ChampionshipRace]
ADD CONSTRAINT [FK_ChampionshipRace_inherits_Race]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[Races]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Id] in table 'Races_FreeRace'
ALTER TABLE [dbo].[Races_FreeRace]
ADD CONSTRAINT [FK_FreeRace_inherits_Race]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[Races]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------